import BaseConfig from "./config/Config.vue";
import Product from "./product/Product.vue";
import TemplateVue from "./template/Template.vue";

export type Step = {
  name: string;
  component: any;
  step: number;
};

export const currentStep = ref<Step>({
  step: 1,
  component: markRaw(BaseConfig),
  name: "基本配置"
});
export const steps = ref<Step[]>([
  {
    name: "基本配置",
    component: markRaw(BaseConfig),
    step: 1
  },
  {
    name: "选择商品",
    component: markRaw(Product),
    step: 2
  },
  {
    name: "选择模板",
    component: markRaw(TemplateVue),
    step: 3
  }
]);
export const setStep = (index: number) => {
  const result = steps.value.find((e) => {
    if (e.step === index) {
      return e;
    }
    return null;
  });
  if (!result) return;
  currentStep.value = result;
};
